export class TableHelper {
    defaultPageSizeList = [5, 10, 25, 50, 100, 250, 500];

    defaultPageSize = 10;

    defaultResultMaxCount = 10;

    totalRecordsCount = 0;

    pageIndex = 1;

    records: any[];

    isLoading = true;

    sort: {
        key: string,
        value: string
    };

    getSorting(): string {
        let sorting;
        if (this.sort) {
            sorting = this.sort.key;
            if (this.sort.value === 'descend') {
                sorting += ' DESC';
            } else if (this.sort.value === 'ascend') {
                sorting += ' ASC';
            }
        }
        return sorting;
    }

    getMaxResultCount(): number {
        return this.defaultResultMaxCount;
    }

    getSkipCount(): number {
        return (this.pageIndex - 1) * this.defaultPageSize;
    }
}
